home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / WINSERTL.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  73 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3. #undef winsert
  4.  
  5. #ifndef        NDEBUG
  6. char *rcsid_winsertl = "$Header: c:/curses/portable/RCS/winsertl.c%v 2.0 1992/11/15 03:29:09 MH Rel $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   winsert()    - Insert line
  15.  
  16.   X/Open Description:
  17.        A blank line is inserted above the current line and the bottom
  18.        line is lost.
  19.  
  20.        NOTE: insertln() is a macro.
  21.  
  22.   PDCurses Description:
  23.        The mv[w]insertln() routines have been added to the X/Open
  24.        interface specification as a convienience.
  25.  
  26.   X/Open Return Value:
  27.        These functions return OK on success and ERR on error.
  28.  
  29.   PDCurses Errors:
  30.        It is an error to call this function with a NULL window pointer.
  31.  
  32.   Portability:
  33.        PDCurses        int winsertln( WINDOW* win );
  34.        X/Open Dec '88  int winsertln( WINDOW* win );
  35.        BSD Curses      int winsertln( WINDOW* win );
  36.        SYS V Curses    int winsertln( WINDOW* win );
  37.  
  38.  
  39. **man-end**********************************************************************/
  40.  
  41. int    winsertln(WINDOW *win)
  42. {
  43.        chtype  blank;
  44.        chtype* temp;
  45.        chtype* end;
  46.        short   y;
  47.  
  48.        if (win == (WINDOW *)NULL)
  49.                return( ERR );
  50.  
  51.        blank   = win->_blank | win->_attrs;
  52.        temp    = win->_y[win->_bmarg];
  53.  
  54.        for (y = win->_bmarg; y > win->_cury; y--)
  55.        {
  56.                win->_y[y]       = win->_y[y - 1];
  57.                win->_firstch[y] = 0;
  58.                win->_lastch[y] = win->_maxx - 1;
  59.        }
  60.  
  61.        win->_y[win->_cury] = temp;
  62.  
  63.        for (end = &temp[win->_maxx - 1]; temp <= end; temp++)
  64.        {
  65.                *temp = blank;
  66.        }
  67.  
  68.        win->_firstch[win->_cury] = 0;
  69.        win->_lastch[win->_cury] = win->_maxx - 1;
  70.  
  71.        return( OK );
  72. }
  73.